package edu.washington.cs.pomdb;

import java.awt.Color;


/**
 * @author Yanping Huang
 *
 */
public class ExpCtrl {
	static double [] coherenceLevels = {-0.512,-0.256,-0.128,-0.064,-0.032,0,0.032,0.064,0.128,0.256,0.512};
	
	
	public enum Rewards{
		R_P(100.0),
		R_N(0.0),
		R_W(-1.0);
		
		private double reward;
		
		Rewards(double r){
			this.setReward(r);
		}

		public void setReward(double reward) {
			this.reward = reward;
		}

		public double getReward() {
			return reward;
		}
		
	}
	
	//TODO define graphics for each observations
	public enum Observations{
		O_L(Color.blue), O_R(Color.red);
		private Color c;
		Observations(Color c){
			this.c = c;
		}
		
		public Color getColor(){			
			return c;
		}
	}
	
	public enum Actions{
		A_L(Color.blue), A_W(Color.white),	A_R(Color.red);
		
		private Color c;
		Actions(Color c){
			this.c = c;
		}
		
		public Color getColor(){			
			return c;
		}
	}
	
	static int findCohrence(double coherence){
		int l = 0;
		int r = coherenceLevels.length - 1;
		while(l <= r){
			int m = l + (r-l)/2;
			if(coherenceLevels[m] == coherence)
				return m;
			else if(coherenceLevels[m] > coherence){
				r = m - 1;
			}
			else
				l = m + 1;
				
		}
		return -1;//not found
	}
}
